package demo;

public class GeoToolsDemo {

    public static void main(String[] args) {
        // 经纬度坐标1
        double lon1 = 118.90938768363253;
        double lat1 = 32.114418507077275;

        // 经纬度坐标2
        double lon2 = 118.90863038848431;
        double lat2 = 32.11561403069807;

        // 使用 GeoTools 计算距离
//        double distance = calculateDistance(lon1, lat1, lon2, lat2);

//        System.out.println("真实距离: " + distance + " 米");
    }

//    private static double calculateDistance(double lon1, double lat1, double lon2, double lat2) {
//        GeodeticCalculator calculator = new GeodeticCalculator(DefaultGeographicCRS.WGS84);
//        calculator.setStartingGeographicPoint(lon1, lat1);
//        calculator.setDestinationGeographicPoint(lon2, lat2);
//        return calculator.getOrthodromicDistance();
//    }
}
